home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / applets / collectn / daenumer.jav < prev    next >
Encoding:
Text File  |  1995-10-14  |  1.0 KB  |  42 lines

  1. /*
  2.   File: DAEnumeration.java
  3.  
  4.   Originally written by Doug Lea and released into the public domain. 
  5.   Thanks for the assistance and support of Sun Microsystems Labs, Agorics 
  6.   Inc, Loral, and everyone contributing, testing, and using this code.
  7.  
  8.   History:
  9.   Date     Who                What
  10.   24Sep95  dl@cs.oswego.edu   Create from collections.java  working file
  11.   13Oct95  dl                 Changed protection statuses
  12.  
  13. */
  14.   
  15. package collections;
  16.  
  17. /**
  18.  *
  19.  * Enumerator for collections based on dynamic arrays.
  20.  * @author Doug Lea
  21.  * @version 0.93
  22.  *
  23.  * <P> For an introduction to this package see <A HREF="index.html"> Overview </A>.
  24. **/
  25. final class DAEnumeration extends CEImpl {
  26.   private Object [] arr_;
  27.   private int cur_;
  28.  
  29.   public DAEnumeration(UpdatableCollection c, Object arr[]) { 
  30.     super(c); arr_ = arr; cur_ = 0;
  31.   }
  32.  
  33. /**
  34.  * Implements java.util.Enumeration.nextElement().
  35.  * @see java.util.Enumeration#nextElement()
  36. **/
  37.   public Object nextElement() {  
  38.     decRemaining();
  39.     return  arr_[cur_++];  
  40.   }
  41. }
  42.